<?php echo $this->Session->flash(); ?>
<h1>TITULACIÓN E INFORMACIÓN JURÍDICA</h1>
<?php
App::Import('model', 'Owner');
$p = new Owner();
?>
<table  id="tabla" class="tabla" >
    <thead>
        <tr>
            <th>Codigo predio</th>
            <th>Propietario</th>
            <th>Titulo de adquisición</th>
            <th>Matricula</th>
            <th>Servidumbre</th>
            <th></th>
        </tr>
    </thead>
    <tbody>

        <?php
        foreach ($propiedades as $propiedad):
            ?>            
            <tr>
                <td><?php echo $propiedad['Property']['codigo'] ?></td>
                <td>
                    <?php
                    $propietarios = $p->find('all', array('conditions' => array('Owner.property_id' => $propiedad['Property']['id']), 'fields' => array('Owner.nombres', 'Owner.primer_apellido', 'Owner.segundo_apellido')));
                    foreach ($propietarios as $propietario) {
                        echo $propietario['Owner']['nombres'] . " " . $propietario['Owner']['primer_apellido'] . " " . $propietario['Owner']['segundo_apellido'] . "<br>";
                    }
                    ?>
                </td>
                <td><?php echo $propiedad['PropertyAppraisal']['titulo'] ?></td>
                <td><?php echo $propiedad['Property']['matricula'] ?></td>
                <td><?php
                if ($propiedad['PropertyAppraisal']['servidumbre']) {
                    echo "Si";
                } else {
                    echo "No";
                }
                    ?></td>
                <td>
                    <?php
                    
                    echo $ajax->link("Modificar información", array('controller' => 'PropertyAppraisals', "action" => "add_legal_information", $propiedad['PropertyAppraisal']['id'], $propiedad['PropertyAppraisal']['property_id']), array('update' => 'legal_information', 'complete' => 'mayusculas()', 'indicator' => 'loading'))
                    ?>
                </td>
            </tr>
        <?php endforeach; ?>
    </tbody>
</table>

